package cn.samler.shopapi.Mapper;

import cn.samler.shopapi.Entity.Classify;
import cn.samler.shopapi.Entity.SpecItem;
import cn.samler.shopapi.Model.Response.Goods.GoodsBrief;
import cn.samler.shopapi.Model.Response.Goods.GoodsDetails;
import cn.samler.shopapi.Model.Response.Goods.Spec;
import org.apache.ibatis.annotations.Param;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;

import java.util.List;

@EnableAsync
public interface GoodsMapper {
    List<Classify> getClassify();

    List<GoodsBrief> getGoodsByClassify(@Param("cid") int cid, @Param("start") int start, @Param("offset") int offset);

    List<GoodsBrief> getGoodsByHot();

    List<GoodsBrief> getGoodsByNewest();

    List<GoodsBrief> getGoodsBriefByIdList(List<Integer> idList);

    GoodsDetails getGoodsById(int id);

    List<Spec> getSpecByGoodsId(int gid);

    List<SpecItem> getSpecItemBySpecId(int sid);

    cn.samler.shopapi.Entity.Spec getSpecById(@Param("gid") int gid, @Param("id") int id);

    SpecItem getSpecItemById(@Param("sid") int sid, @Param("id") int id);

    @Async
    void incrGoodsVisit(int id);

    @Async
    void incrGoodsSales(int id);
}
